// app.js
App({
  onLaunch: function () {
    this.getBasicInfo()
    wx.login({
      success: (res) => {
        console.log(res)
        // setTimeout(() => {
          this.globalData.token = '123456';
          if (this.getloginCallback) {
            this.getloginCallback(this.globalData.token);
          }
        // }, 800);
      },
      fail: (failS) => {
        console.log(failS)
      },
    })
  },
  getBasicInfo() {
     // 获取系统信息
     const { theme,model,screenWidth,screenHeight,windowWidth,windowHeight,statusBarHeight,platform } = wx.getSystemInfoSync();
     console.log(theme);
     // 获取胶囊按钮信息
     const { width, height, top,right,bottom,left } = wx.getMenuButtonBoundingClientRect();
    // 胶囊宽度 + 右侧距离
    this.globalData.menuRight = windowWidth - right + width
    //导航栏总体高度
    this.globalData.navHeight =  statusBarHeight + height + (top - statusBarHeight) * 2
    //胶囊距离顶部距离
    this.globalData.menuTop = top
    //胶囊高度
    this.globalData.menuHeight = height
    // 可使用窗口宽度/ 高度
    this.globalData.windowWidth = windowWidth;
    this.globalData.windowHeight = windowHeight;
    // 状态栏的高度
    this.globalData.statusBarHeight = statusBarHeight
    this.globalData.theme = theme
    console.log(this.globalData);
    /** 获取设备类型 */
    if (platform == "ios") {
      this.globalData.deviceType = "ios";
    }
    if (platform == "android") {
      this.globalData.deviceType = "android";
    }
  },
  globalData: {
    token: null,
  },
})